//
//  PPMeCellFrame.m
//  PropertyManage
//
//  Created by Dreamsoul on 15-1-26.
//  Copyright (c) 2015年 com.lab603.mc. All rights reserved.
//

#import "PPMeCellFrame.h"
#import "PPMe.h"
#define  cellpadding 5
@implementation PPMeCellFrame
-(void)setMe:(PPMe *)me{
    _me = me;
    //背景图片
    CGFloat backgroundViewX = 0;
    CGFloat backgroundViewY = 0;
    CGFloat backgroundViewW = [UIScreen mainScreen].bounds.size.width;
    //根据内容计算得高度
    CGFloat backgroundViewH = 0;
    //类别icon
    CGFloat iconX = 4*cellpadding;
    CGFloat iconY = cellpadding;
    CGSize  iconSize = {30 ,30};
    _iconF = (CGRect){{iconX,iconY},iconSize};
    
    //类别Label
    CGFloat typeX = CGRectGetMaxX(_iconF)+8*cellpadding;
    CGFloat typeY = iconY+cellpadding;
    CGSize  typeSize = [me.typeString sizeWithFont:[UIFont systemFontOfSize:14.0]];
    _typeF = (CGRect){{typeX,typeY},typeSize};
    
    //计算得高度以及cell的高度
    if (CGRectGetMaxY(_iconF)>=CGRectGetMaxY(_typeF)) {
        backgroundViewH = CGRectGetMaxY(_iconF)+cellpadding;
    }else{
        backgroundViewH = CGRectGetMaxY(_typeF)+cellpadding;
    }
    _backgroundViewF = CGRectMake(backgroundViewX, backgroundViewY, backgroundViewW, backgroundViewH);
    
    //cellHeight
    _cellheight = backgroundViewH;
}
@end
